x,y = map(int, input().split())
count = 0
ls = []


for i in range(x, y + 1):
    if (i % 4 == 0 and i % 100 != 0) or i % 400 == 0:
        ls.append(i)
        count += 1

print(count)
for i in ls:
    print(i, end=' ')